<template>
  <div>
		<BreadCrumb />
		<student-table
			:list="tableData.records"
			caozuo
			@update="update"
			@del="del"></student-table>
		<el-pagination
			background
			layout="prev, pager, next"
			v-model:current-page="params.pageNo"
			:page-count="tableData.pages"
			@current-change="getTableData"/>
  </div>
</template>

<script setup>
import BreadCrumb from '@@/menu/breadcrumb'
import StudentTable from '@@/student/table'
import { reactive, ref } from 'vue'
import { get, post, baseURL } from '@/axios'
import router from '@/router'
const uploadURL = baseURL + '/umsStudent/upload'
const tableData = ref({})
const params = reactive({
	pageNo: 1,
	pageSize: 9
})
getTableData()
function getTableData () {
	get('/umsStudent/list', params, content => {
		tableData.value = content
	})
}
function update (id) {
	router.push({
		path: '/student/update',
		query: {
			id
		}
	})
}
function del (id, active) {
	post('/umsStudent/delete', { id, active }, content => {
		getTableData()
	})
}
function upload (file) {
	post(uploadURL, { file: file.raw }, content => {
		console.dir(content)
	})
}
</script>

<style scoped lang="scss">
.el-pagination {
	margin-top: 10px;
}
.el-space {
	margin-bottom: 10px;
}
</style>